﻿    <controls:ChildWindow xmlns:inputToolkit1="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"  xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"  
             x:Class="ibba.src.norisk.PageDetalheProdutoModalidade"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
            xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
        	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" 
            xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
            xmlns:src="clr-namespace:ibba.src.norisk"
	        HorizontalAlignment="Center" 
	        VerticalAlignment="Center" xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" 
			 xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
			 Height="440" Width="578" 
			 Title="Detalhes parametrização"
			 Background="#FF5C7590">

    <controls:ChildWindow.Resources>
        <src:ConverterNumericUpDown x:Key="ConverterNUD" />
        <src:ConverterTypeCheckBox x:Key="ConverterCHK" />
        <src:ConverterValueCheckBox x:Key="ConverterValueCHK" />
    </controls:ChildWindow.Resources>

    

    <Grid x:Name="LayoutRoot" 
          Background="{x:Null}"  Height="428" VerticalAlignment="Top" HorizontalAlignment="Left" Width="558" Margin="0,-23,0,0" >
		 <!--   <Border Margin="2,1,0,0" CornerRadius="8" 
			        Background="#FF718FAE" 
					VerticalAlignment="Top" Height="52" Width="199" HorizontalAlignment="Left"  />
            -->
       	
	
        
     <!--   <Border Margin="0,0,0,0" CornerRadius="10,10,10,10" 
			    Background="#FF5C7590" Width="558" HorizontalAlignment="Left" VerticalAlignment="Stretch"   />
-->
           <!-- <TextBlock 
                       Text="Detalhes parametrização" 
                       FontSize="14"
                       FontFamily="Verdana"
                       Foreground="#FFF4EBD2"
                       Margin="12,6,0,0" 
					   VerticalAlignment="Top"
					   Width="auto" HorizontalAlignment="Left" />
					   -->

		<TextBlock 
                   	Text="Produto" 
                   	FontSize="10"
                   	Foreground="#FFF2ECDA"
                   	Margin="15,38,0,0" 
					VerticalAlignment="Top" Width="auto" 
					HorizontalAlignment="Left" FontFamily="Verdana" d:LayoutOverrides="VerticalAlignment, Width" 
				/>
				
        <TextBlock 
					x:Name="txtCodigoProduto" 
                   	Text="CodigoProduto" 
                   	FontSize="10"
                   	Foreground="#FFFADE88"
                   	Margin="81,37,0,0" 
					VerticalAlignment="Top" Width="auto" 
					HorizontalAlignment="Left" FontFamily="Verdana" d:LayoutOverrides="VerticalAlignment" FontWeight="Bold" 
				/>
        <TextBlock 
        	x:Name="txtDescricaoProduto" 
        	Text="DescricaoProduto" 
        	FontSize="10"
        	Foreground="#FFFADE88" 
        	VerticalAlignment="Top" 
            Width="auto" FontFamily="Verdana" FontWeight="Bold" 
            Margin="260,37,0,0" 
            HorizontalAlignment="Left" 
            	/>
    	<TextBlock 
    		FontSize="10"
    		Foreground="#FFF2ECDA"
    		Margin="14,60,0,0" 
    		VerticalAlignment="Top" Width="auto" FontFamily="Verdana" HorizontalAlignment="Left" d:LayoutOverrides="Width" 
			Text="Modalidade"	/>
    	<TextBlock 
    		x:Name="txtCodigoModalidade" 
    		Text="CodigoModalidade" 
    		FontSize="10"
    		Foreground="#FFFADE88"
    		Margin="81.221,60,0,0" 
    		Width="auto" FontFamily="Verdana" HorizontalAlignment="Left" d:LayoutOverrides="Width, Height" VerticalAlignment="Top" FontWeight="Bold" 
				/>
    	<TextBlock 
    		x:Name="txtDescricaoModalidade" 
    		Text="DescricaoModalidade" 
    		FontSize="10"
    		Foreground="#FFFADE88" 
    		Width="auto" FontFamily="Verdana" 
            VerticalAlignment="Top" FontWeight="Bold" 
            Margin="260,60,0,0" 
            HorizontalAlignment="Left" 
				/>
    	<Border Margin="2,92,0,65" Opacity="0.2" Background="#FFC3E9F4"/>
    	<CheckBox Margin="16,109,0,0" x:Name="chkUtilizadoProcessamento" FontFamily="Verdana" FontSize="10" 
					Foreground="#FFF2ECDA" Content="Utilizar no processamento" HorizontalAlignment="Left" Width="163" d:LayoutOverrides="HorizontalAlignment" Height="17" VerticalAlignment="Top"/>
    	<CheckBox 	x:Name="chkExibirIntranet" 
					FontFamily="Verdana" FontSize="10" Foreground="#FFF2ECDA" Content="Exibir na Intranet" 
					Margin="16,133,0,0" HorizontalAlignment="Left" Width="163" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment" Height="17"/>
    	<CheckBox x:Name="chkPre" FontFamily="Verdana" FontSize="10" Foreground="#FFF2ECDA" 
					Content="Produto/Modalidade exclusivo para risco comprometido (Pré)"  
					Margin="16,182,0,0" Width="Auto" HorizontalAlignment="Left" Grid.Row="0" Grid.RowSpan="1" d:LayoutOverrides="Height" VerticalAlignment="Top"/>
    	<CheckBox x:Name="chkIsda" FontFamily="Verdana" FontSize="10" Foreground="#FFF2ECDA" 
					Content="Passível de tratamento ISDA" Margin="16,157,375,0" VerticalAlignment="Top" Height="17" d:LayoutOverrides="HorizontalAlignment"/>
    	<TextBlock 
    		Text="Valor utilizado na base de cálculo do risco" 
    		FontSize="10"
    		Foreground="#FFF2ECDA" Width="119" FontFamily="Verdana" Margin="279,109,0,0" d:LayoutOverrides="HorizontalAlignment" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Height="32" 
				/>
    	<ComboBox Margin="402,109,0,0" x:Name="cboBaseCalculoRisco"
    		SelectedItem="{Binding Mode=OneWay, Path=codigo}" 
    		DisplayMemberPath="descricao" HorizontalAlignment="Left" Width="143" d:LayoutOverrides="HorizontalAlignment, Height" VerticalAlignment="Top"/>
    	<TextBlock 
    		Text="Classe de produto" 
    		FontSize="10"
    		Foreground="#FFF2ECDA"
    		Width="Auto" 
    		HorizontalAlignment="Left" FontFamily="Verdana" Margin="279.141,145,0,0" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment, Height" 
				/>
    	<ComboBox Height="20" VerticalAlignment="Top" x:Name="cboClasseProduto" RenderTransformOrigin="0.478,0.5" 
    		Margin="402,142,0,0"
    		SelectedItem="{Binding Mode=OneWay, Path=id}" 
    		DisplayMemberPath="descricao" 
            d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" 
            HorizontalAlignment="Left" Width="143"  SelectionChanged="cboClasseProduto_SelectionChanged"/>
            
        <data:DataGrid Name="grdParametros"  
                       Margin="16,0,0,74" 
                       HorizontalAlignment="Left" Width="529" Background="#FF9AACB7"
                       AutoGenerateColumns="False" Height="140" VerticalAlignment="Bottom"    >
                <data:DataGrid.Columns>
                    <data:DataGridTextColumn Header="Id" Width="1" Binding="{Binding Path=Id}" Visibility="Collapsed"/>
                    <data:DataGridTextColumn Header="Configurações do produto" Width="400" Binding="{Binding Path=descricao}" IsReadOnly="True" />
                    <data:DataGridTemplateColumn  Header="Valor" Width="100"  >
                        
                        <data:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Name="panelValor"  VerticalAlignment="Top" Margin="0" Orientation="Horizontal">
                                    <inputToolkit1:NumericUpDown Name="nup" Width="100" 
                                            Value="{Binding Path=valor, Mode=TwoWay}" HorizontalAlignment="Left"   
                                                                 VerticalAlignment="Top" Margin="0" Increment="1.00" DecimalPlaces="2"
                                            Visibility="{Binding Path=TipoCampo, Converter={StaticResource ConverterNUD}}"
                                                          />
                                    
                                    <CheckBox Width="30" HorizontalAlignment="Center"   VerticalAlignment="Top" 
                                              IsChecked="{Binding Path=valor, Converter={StaticResource ConverterValueCHK}, Mode=TwoWay}"
                                              Visibility="{Binding Path=TipoCampo, Converter={StaticResource ConverterCHK}}"/>
                                </StackPanel>
                            </DataTemplate>
                        </data:DataGridTemplateColumn.CellTemplate>
                        
                        <data:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <StackPanel Name="panelValor"  VerticalAlignment="Top" Margin="0" Orientation="Horizontal">
                                    
                                    <inputToolkit1:NumericUpDown Name="nup" Width="100" 
                                            Value="{Binding Path=valor, Mode=TwoWay}" HorizontalAlignment="Left"   
                                                                 VerticalAlignment="Top" Margin="0" Increment="1.00" DecimalPlaces="2"
                                            Visibility="{Binding Path=TipoCampo, Converter={StaticResource ConverterNUD}}"
                                                          />
                                    <CheckBox Width="30" HorizontalAlignment="Center"   VerticalAlignment="Top" 
                                              IsChecked="{Binding Path=valor, Mode=TwoWay}"
                                              Visibility="{Binding Path=TipoCampo, Converter={StaticResource ConverterCHK}}"/>
                                </StackPanel>
                            </DataTemplate>
                        </data:DataGridTemplateColumn.CellEditingTemplate>
                        
                    </data:DataGridTemplateColumn >
                </data:DataGrid.Columns>
                
            </data:DataGrid>
            
            <Grid Height="40" Margin="8,0,0,12" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="540" >
        
    		<Border Background="#FF9AACB7" CornerRadius="10" />
    		<Button 
    			Margin="12,7,0,8" 
    			Width="120" 
    			HorizontalAlignment="Left" 
    			x:Name="btnEditar"
    			Click="btnEditar_Click" TabIndex="16" d:LayoutOverrides="HorizontalAlignment">
    			<StackPanel Orientation="Horizontal">
    				<Image Source="../image/edit_doc.png" Height="16" />
    				<TextBlock Text="Editar" Margin="10,0,0,0"/>
    			</StackPanel>
    		</Button>
    		<Button 
    			Margin="141.391,7,0,8" 
    			Width="120" 
    			HorizontalAlignment="Left" d:LayoutOverrides="HorizontalAlignment" 
    			x:Name="btnCancelar"
    			Click="btnRejeitar_Click" TabIndex="12">
    			<StackPanel Orientation="Horizontal">
    				<Image Source="../image/eraser.png" Height="16"   />
    				<TextBlock Text="Cancelar" Margin="10,2,0,0"/>
    			</StackPanel>
    		</Button>
    		<Button 
    			Margin="271.391,7,145.609,8" 
    			x:Name="btnSalvar"    
    			Click="btnSalvar_Click" TabIndex="14">
    			<StackPanel Orientation="Horizontal">
    				<Image Source="../image/save.png" Height="16" />
    				<TextBlock Text="Salvar" Margin="10,0,0,0"/>
    			</StackPanel>
    		</Button>
    		<Button 
    			Width="120" 
    			HorizontalAlignment="Right" 
    			x:Name="btnFechar"    
    			Click="btnFechar_Click" TabIndex="18" Margin="0,7,15,8" RenderTransformOrigin="0.455,-0.92">
    			<StackPanel Orientation="Horizontal">
    				<Image Source="../image/voltar.png" Height="34" Width="34" Margin="0,-18,0,0" 
    					Stretch="Uniform" VerticalAlignment="Top" HorizontalAlignment="Left" />
    				<TextBlock Text="Voltar" Margin="-8,0,0,0"/>
    			</StackPanel>
    		</Button>
        
    	</Grid>
        
    </Grid>
    

    
</controls:ChildWindow>
